    //
//  LeftPanelViewController.m
//  DemoLeftAndRightPanel
//
//  Created by duc nguyen van on 8/12/11.
//  Copyright 2011 STU. All rights reserved.
//

#import "LeftPanelViewController.h"

#define IMAGE_WIDTH   200
#define IMAGE_HEIGHT  200

@implementation LeftPanelViewController
@synthesize scrollImages;

#pragma mark -
#pragma mark event click
-(IBAction)lelftClick:(id)sender{

	if (checkLeft == NO) {
		[UIView beginAnimations:nil context:NULL];
		self.view.frame = CGRectMake(self.view.frame.origin.x  - self.view.frame.size.width + 10,
									 self.view.frame.origin.y,
									 self.view.frame.size.width,
									 self.view.frame.size.height);
		[UIView setAnimationDelay:1000];
		[UIView commitAnimations];
		checkLeft = YES;
	}
	else {
		[UIView beginAnimations:nil context:NULL];
		self.view.frame = CGRectMake(self.view.frame.origin.x  + self.view.frame.size.width - 10,
									 self.view.frame.origin.y,
									 self.view.frame.size.width,
									 self.view.frame.size.height);
		[UIView commitAnimations];
		checkLeft = NO;
	}

}

 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization.
    }
    return self;
}
*/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	
	checkLeft = NO;
	NSMutableArray *arrImages = [[NSMutableArray alloc] initWithObjects:@"Hinh02.jpg",@"Hinh03.jpg",@"Hinh04.jpg",@"Hinh05.jpg",@"Hinh06.jpg",@"Hinh07.jpg",@"Hinh08.jpg",@"Hinh11.jpg",nil];
	
	int i = 0;
	for (NSString *image in arrImages) {
		UIImage *ima = [UIImage imageNamed:image];
		UIImageView *imageView = [[UIImageView alloc] initWithImage:ima];
		
		imageView.contentMode = UIViewContentModeScaleToFill;
		imageView.clipsToBounds = YES;
		
		imageView.frame = CGRectMake( 0, IMAGE_HEIGHT * i++, IMAGE_WIDTH, IMAGE_HEIGHT);
		[scrollImages addSubview:imageView];
		[imageView release];
	}
	scrollImages.contentSize = CGSizeMake(IMAGE_WIDTH, IMAGE_HEIGHT * i);
}



- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Overriden to allow any orientation.
    return YES;
}


- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}


- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
